const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('sp_express', {
    express_id: {
      autoIncrement: true,
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      primaryKey: true,
      comment: "主键id"
    },
    order_id: {
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      comment: "订单id"
    },
    express_com: {
      type: DataTypes.STRING(32),
      allowNull: true,
      comment: "订单快递公司名称"
    },
    express_nu: {
      type: DataTypes.STRING(32),
      allowNull: true,
      comment: "快递单编号"
    },
    create_time: {
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      comment: "记录生成时间"
    },
    update_time: {
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      comment: "记录修改时间"
    }
  }, {
    sequelize,
    tableName: 'sp_express',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "express_id" },
        ]
      },
      {
        name: "order_id",
        using: "BTREE",
        fields: [
          { name: "order_id" },
        ]
      },
    ]
  });
};
